LICENSE = "GPLv2"
LIC_FILES_CHKSUM = "file://COPYING;md5=6306e547e5c5e43190193019ed46ee13"

DEPENDS = "fcitx fcitx-tools-native qtbase-native"
RDEPENDS_${PN} = "fcitx fcitx-data fcitx-modules qtbase"

SRC_URI = "https://gitlab.com/fcitx/fcitx-qt5/-/archive/${PV}/fcitx-qt5-${PV}.tar.bz2"
SRC_URI[md5sum] = "550a0f6215c75a7338ddeef30b3ef245"
SRC_URI[sha256sum] = "741904439c4a7461c5b19b6e9fcdf1446c440ed10c2171f8325ec0ceaff0a65c"

S = "${WORKDIR}/${PN}-${PV}/"

inherit cmake pkgconfig qt6-cmake

EXTRA_OECMAKE += " \
    -DENABLE_QT5=OFF \
    -DENABLE_QT6=ON \
    -DCMAKE_SYSROOT=${RECIPE_SYSROOT} \
    -DMAKE_INSTALL_PREFIX=/usr \
    -DLIB_INSTALL_DIR=${libdir} \
    -DCMAKE_INSTALL_QTPLUGINDIR=${libdir}/qt6/plugins/ \
    -DFCITX_TOOL_BINARY_DIR=${STAGING_LIBDIR_NATIVE}/fcitx/ \
"
FILES:${PN} += " \
    ${libdir}/plugins/platforminputcontexts/libfcitxplatforminputcontextplugin.so \
    ${libdir}/fcitx/libexec/fcitx-qt6-gui-wrapper \
"

FILES:${PN}:remove= " ${libdir}/fcitx/qt/libfcitx-quickphrase-editor5.so"

FILES:${PN}-dev += "${libdir}/cmake/FcitxQt6WidgetsAddons \
    ${libdir}/cmake/FcitxQt6DBusAddons \
"
